/*

   Copyright 2009 BBC Research, David Lewis, <david.lewis4@bbc.co.uk>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

 */
package MessageHandler;

import java.util.ArrayList;


public class GPSDevice {

    private long lastSeen;
    private ArrayList<Integer> timestamp = new ArrayList<Integer>();
    private ArrayList<Double> lat = new ArrayList<Double>();
    private ArrayList<Double> lon = new ArrayList<Double>();
    private ArrayList<Float> alt = new ArrayList<Float>();
    private ArrayList<Float> hac = new ArrayList<Float>();
    private ArrayList<Float> vac = new ArrayList<Float>();
    private ArrayList<Float> bearing = new ArrayList<Float>();
    private ArrayList<Float> speed = new ArrayList<Float>();

  

    public void addPosition(Double lat, Double lon, Float alt, Float hac, Float vac, Float bearing, Float speed){
        this.lat.add(lat);
        this.lon.add(lon);
        this.alt.add(alt);
        this.hac.add(hac);
        this.vac.add(vac);
        this.bearing.add(bearing);
        this.speed.add(speed);
        lastSeen = System.currentTimeMillis();
    }
    
    public Double[] getLatLong(){
        return new Double[] {lat.get(lat.size()-1),lon.get(lon.size()-1)};
    }

    public Float getAltitude() {
        return alt.get(alt.size()-1);
    }

    public Float getBearing() {
        return bearing.get(bearing.size()-1);
    }

    public Float getHorizontalAccuracy() {
        return hac.get(hac.size()-1);
    }

    public Float getSpeed() {
        return speed.get(speed.size()-1);
    }

    public Float getVac() {
        return vac.get(vac.size()-1);
    }

    public int getLastSeenDifference(){
        return Math.round((System.currentTimeMillis() - lastSeen)/1000);
    }

    public void setLastSeen(){
        lastSeen = System.currentTimeMillis();
    }


}
